package 代码记录.指定公司代码练习记录.华为_2024.分值100;

import java.util.Scanner;

/**
 * @author zx
 * @create 2024-01-27 23:39
 * 自己做出来了
 * 人家写的代码可以用Character类的方法判断是否字母、数字、空白符等，感觉很吊，后续学习一下
 */
public class 密码输入检测_4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for(int i = 0;i < s.length();i++){
            if(s.charAt(i) == '<' && i == 0){
                s = s.substring(1,s.length());
            }else if(s.charAt(i) == '<' && i > 0){
                s = s.substring(0,i - 1) + s.substring(i + 1, s.length());
            }
        }
        boolean isA = false;
        boolean isa = false;
        boolean is1 = false;
        boolean ist = false;
        for(int i = 0;i < s.length();i++){
            if(s.charAt(i) >= 'A' && s.charAt(i) <= 'Z'){
                isA = true;
            }else if(s.charAt(i) >= 'a' && s.charAt(i) <= 'z'){
                isa = true;
            }else if(s.charAt(i) >= '0' && s.charAt(i) <= '9'){
                is1 = true;
            }else{
                ist = true;
            }
        }
        boolean res = false;
        if(isA && isa && is1 && ist && s.length() >= 8){
            res = true;
        }
        System.out.println(s.toString() + "," + res);
    }
    /*
    public static String processPassword(String inputStream) {
        StringBuilder stack = new StringBuilder();
        for (char ch : inputStream.toCharArray()) {
            if (ch == '<') {
                if (stack.length() > 0) {
                    stack.deleteCharAt(stack.length() - 1);
                }
            } else {
                stack.append(ch);
            }
        }
        return stack.toString();
    }

    public static boolean checkPasswordRequirements(String password) {
        boolean lengthCheck = password.length() >= 8;
        boolean uppercaseCheck = false;
        boolean lowercaseCheck = false;
        boolean digitCheck = false;
        boolean specialCharCheck = false;

        for (char ch : password.toCharArray()) {
            if (Character.isUpperCase(ch)) {
                uppercaseCheck = true;
            } else if (Character.isLowerCase(ch)) {
                lowercaseCheck = true;
            } else if (Character.isDigit(ch)) {
                digitCheck = true;
            //判断给定的字符ch是否既不是字母或数字，也不是空白字符（例如空格、制表符等）
            } else if (!Character.isLetterOrDigit(ch) && !Character.isWhitespace(ch)) {
                specialCharCheck = true;
            }
        }

        return lengthCheck && uppercaseCheck && lowercaseCheck && digitCheck && specialCharCheck;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String inputStream = scanner.nextLine().trim();

        String password = processPassword(inputStream);
        boolean isValid = checkPasswordRequirements(password);

        System.out.println(password + "," + isValid);
    }
    */
}
